package com.gitee.chili.leisure.core;

import com.gitee.chili.leisure.model.MessageCmdEnum;
import lombok.Data;

/**
 * 消息包数据
 *
 * 这里可以做消息冗余校验, 安全认证， 密码认证， 等等
 *
 * @author week solider
 * @since 2020.08.31
 */
@Data
public class Packet {

    private MessageCmdEnum.Command cmd;

    private byte[] body;

    public Packet(MessageCmdEnum.Command cmd, byte[] body) {
        this.cmd = cmd;
        this.body = body;
    }

    public static Packet newPacket(MessageCmdEnum.Command cmd, byte[] body){
        return new Packet(cmd, body);
    }
}
